﻿using Domain.Entities;
using FluentMigrator;
using FrameworkCore.Extensions;

namespace AiBLSmartEdu.Module.SmartPhysics.API.Migrations;

[Migration(202409251043)]
public class PhysicsQuestionAddColumn : ForwardOnlyMigration
{
    public override void Up()
    {
        Alter.Table(MigrationExpressions.GetTableName(typeof(PhysicsQuestion)))
          .AddColumn(MigrationExpressions.ColumnNameFor<PhysicsQuestion>(nameof(PhysicsQuestion.Question))).AsString(int.MaxValue).Nullable().WithColumnDescription("问题")
          .AddColumn(MigrationExpressions.ColumnNameFor<PhysicsQuestion>(nameof(PhysicsQuestion.Answer))).AsString(int.MaxValue).Nullable().WithColumnDescription("答案")
          .AddColumn(MigrationExpressions.ColumnNameFor<PhysicsQuestion>(nameof(PhysicsQuestion.Status))).AsInt32().Nullable().WithColumnDescription("状态：0待查看；1已解决；2未解决")
          .AddColumn(MigrationExpressions.ColumnNameFor<PhysicsQuestion>(nameof(PhysicsQuestion.IsFavorited))).AsBoolean().Nullable().WithDefaultValue(true).WithColumnDescription("是否收藏");
    }
}